Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of items inside a doc(hidden) block #107000

Merged
merged 10 commits into from
Feb 3, 2023

Conversation

GuillaumeGomez
Copy link
Member

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 17, 2023
@GuillaumeGomez GuillaumeGomez force-pushed the fix-items-in-doc-hidden-block branch from 6184894 to 6921740 Compare January 17, 2023 19:43
src/librustdoc/clean/mod.rs Outdated Show resolved Hide resolved
@GuillaumeGomez GuillaumeGomez force-pushed the fix-items-in-doc-hidden-block branch from 6921740 to 2db19cd Compare January 17, 2023 20:08
// @has - '//p/a' '../../reexp_stripped/struct.Bar.html'
// `Bar` is in a `doc(hidden)` module so the link should point to a non-existing file.
// However, the struct is reexported at the root of the crate so we should point to it.
// @has - '//a[@href="../reexp_stripped/struct.Bar.html"]' 'Bar'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this test is failing. I need to find out why we generate a link to the original location of the item and not to the reexport directly.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the fix-items-in-doc-hidden-block branch from 2db19cd to 5e4bb11 Compare January 17, 2023 23:15
@GuillaumeGomez
Copy link
Member Author

So now just remains to fix the mystery of the bad item linking.

@rust-log-analyzer

This comment has been minimized.

}

// @has 'foo/struct.Private.html'
// @!has - '//*[@id="impl-Bar-for-Private"]/*[@class="code-header"]' 'impl Bar for Private'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this hidden? It means that If have a private type, and use #[derive(Serialize)], the impl won't appear with --document-private-items, which seems undesirable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly the discussion we had here. If something is inside a hidden item's descendants, then it doesn't appear (not private, hidden).

@GuillaumeGomez GuillaumeGomez force-pushed the fix-items-in-doc-hidden-block branch from 5e4bb11 to e42fc33 Compare January 18, 2023 11:08
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the fix-items-in-doc-hidden-block branch from 55ace15 to 0a8d69f Compare January 18, 2023 22:24
@GuillaumeGomez
Copy link
Member Author

So I just pushed a new commit which changes a bit in case the item is reexported how its URL is computed. This is a change that needs to be very carefully reviewed. I'm not sure if this was the right approach to the problem so if someone has another idea in mind that allows to not change how some URLs are generated, it'd be really awesome!

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the fix-items-in-doc-hidden-block branch from 0a8d69f to 0de90bd Compare January 19, 2023 13:50
@GuillaumeGomez
Copy link
Member Author

Fixed the bug! \o/

The problem was that I was removing the item with #[doc(hidden)] and all its children. However, the children should have been stripped, not removed.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the fix-items-in-doc-hidden-block branch from 0de90bd to 6362019 Compare January 19, 2023 16:10
@GuillaumeGomez
Copy link
Member Author

Ok, I forgot to recurse into hidden children. Fixed that too.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the fix-items-in-doc-hidden-block branch from 6362019 to 302c75f Compare January 19, 2023 21:41
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 20, 2023
…iddle

rustdoc: Revert rust-lang#104889

Reverts rust-lang#104889.

I don't think I'll be able to finish rust-lang#107000 on time unfortunately so to prevent rust-lang#106373, better to revert it and to make it into the next release.

r? `@notriddle`
@bors

This comment was marked as resolved.

@GuillaumeGomez GuillaumeGomez force-pushed the fix-items-in-doc-hidden-block branch from 302c75f to 61ce752 Compare January 20, 2023 14:56
@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 27, 2023
@GuillaumeGomez GuillaumeGomez force-pushed the fix-items-in-doc-hidden-block branch from 16d81dc to ea84418 Compare January 27, 2023 19:33
@GuillaumeGomez
Copy link
Member Author

The implementation is now in line with the rest of the implementation blocks handling in rustdoc.

Ready for new review round.

@GuillaumeGomez
Copy link
Member Author

Forgot to change status...

@bors ready

@GuillaumeGomez GuillaumeGomez added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 30, 2023
@notriddle
Copy link
Contributor

@bors r=notriddle,petrochenkov rollup=never

@bors
Copy link
Contributor

bors commented Feb 2, 2023

📌 Commit ea84418 has been approved by notriddle,petrochenkov

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 2, 2023
@bors
Copy link
Contributor

bors commented Feb 2, 2023

⌛ Testing commit ea84418 with merge 6c991b0...

@bors
Copy link
Contributor

bors commented Feb 3, 2023

☀️ Test successful - checks-actions
Approved by: notriddle,petrochenkov
Pushing 6c991b0 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 3, 2023
@bors bors merged commit 6c991b0 into rust-lang:master Feb 3, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 3, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6c991b0): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
4.1% [0.2%, 18.9%] 9
Regressions ❌
(secondary)
1.1% [0.2%, 1.7%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.1% [0.2%, 18.9%] 9

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.3% [1.4%, 3.5%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-3.2%, -1.5%] 2
All ❌✅ (primary) 2.3% [1.4%, 3.5%] 3

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
7.9% [3.9%, 16.6%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 7.9% [3.9%, 16.6%] 4

@rustbot rustbot added the perf-regression Performance regression. label Feb 3, 2023
@notriddle
Copy link
Contributor

This bug isn’t going to be fixed without some kind of perf regression, because it just has to walk through more of the AST. It happened last time for the same reason. #104889 (comment)

@GuillaumeGomez GuillaumeGomez deleted the fix-items-in-doc-hidden-block branch February 3, 2023 09:13
@pnkfelix
Copy link
Member

pnkfelix commented Feb 7, 2023

Agree with @notriddle

@rustbot label: +perf-regression-triaged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rustdoc reports non accessable items in blocks with --document-private-items, even with #[doc(hidden)]
10 participants